{% load i18n %}
{% if SEARCH_FILTERS.CATEGORIES_ENABLED %}
<nav class="filter" ng-cloak>
  <h4><a href="#" class="toggle toggle-nav"><i class="fa fa-chevron-right"></i>{% trans "Categories" %}</a></h4>
  <ul class="nav closed" id="categories">
  {% if facet_type == 'layers' %}
    {% verbatim %}
      <li ng-repeat="category in categories" ng-if="category.layers_count > 0">
        <a data-value="{{ category.identifier }}" data-filter="category__identifier__in" title="{{ category.gn_description }}"
         ng-click="multiple_choice_listener($event)" class="{{category.active}}"><div class="fa-stack fa-1g"><i class="fa fa-square-o fa-stack-2x"></i><i class="fa {{category.fa_class}} fa-stack-1x"></i></div>{{ category.gn_description | limitTo: 20 }}{{ category.gn_description.length > 20 ? '...' : ''}}
          <span class="badge pull-right">{{ category.layers_count }}</span>
        </a>
      </li>
    {% endverbatim %}
  {% else %}
    {% verbatim %}
      <li ng-repeat="category in categories" ng-if="category.count > 0">
        <a data-value="{{ category.identifier }}" data-filter="category__identifier__in" title="{{ category.gn_description }}"
         ng-click="multiple_choice_listener($event)" class="{{category.active}}"><div class="fa-stack fa-1g"><i class="fa fa-square-o fa-stack-2x"></i><i class="fa {{category.fa_class}} fa-stack-1x"></i></div>{{ category.gn_description | limitTo: 20 }}{{ category.gn_description.length > 20 ? '...' : ''}}
          <span class="badge pull-right">{{ category.count }}</span>
        </a>
      </li>
    {% endverbatim %}
  {% endif %}
  </ul>
</nav>
{% endif %}
{% if SEARCH_FILTERS.OWNERS_ENABLED %}
<nav class="filter" ng-cloak>
  <h4><a href="#" class="toggle toggle-nav"><i class="fa fa-chevron-right"></i> {% trans "Responsibles" %}</a></h4>
  <ul class="nav closed" id="owners">
    {% verbatim %}
    <li ng-repeat="owner in owners" ng-if="owner.count > 0">
      <a data-value="{{ owner.username }}" data-filter="owner__username__in" ng-click="multiple_choice_listener($event)" class="{{owner.active}}">{{ owner.full_name }}
        <span class="badge pull-right">{{ owner.count }}</span>
      </a>
    </li>
    {% endverbatim %}
  </ul>
</nav>
{% endif %}
{% if SEARCH_FILTERS.GROUPS_ENABLED %}
    <nav class="filter" ng-cloak>
        <h4><a href="#" class="toggle toggle-nav"><i class="fa fa-chevron-right"></i> {% trans "Groups" %}</a></h4>
        <ul class="nav closed" id="groups">
            {% if facet_type == 'layers' %}
                {% verbatim %}
                <li ng-repeat="group in groups" ng-if="group.resource_counts.layer.total > 0">
                    <a data-value="{{ group.name }}" data-filter="group__group_profile__slug__in" ng-click="multiple_choice_listener($event)" class="{{group.active}}">{{ group.group_profile.title }}
                        <span class="badge pull-right">{{ group.resource_counts.layer.total }}</span>
                    </a>
                </li>
                {% endverbatim %}
            {% elif facet_type == 'documents' %}
                {% verbatim %}
                <li ng-repeat="group in groups" ng-if="group.resource_counts.document.total > 0">
                    <a data-value="{{ group.name }}" data-filter="group__group_profile__slug__in" ng-click="multiple_choice_listener($event)" class="{{group.active}}">{{ group.group_profile.title }}
                        <span class="badge pull-right">{{ group.resource_counts.document.total }}</span>
                    </a>
                </li>
                {% endverbatim %}
            {% elif facet_type == 'maps' %}
                {% verbatim %}
                <li ng-repeat="group in groups" ng-if="group.resource_counts.map.total > 0">
                    <a data-value="{{ group.name }}" data-filter="group__group_profile__slug__in" ng-click="multiple_choice_listener($event)" class="{{group.active}}">{{ group.group_profile.title }}
                        <span class="badge pull-right">{{ group.resource_counts.map.total }}</span>
                    </a>
                </li>
                {% endverbatim %}
            {% elif facet_type == 'geoapps' %}
                {% verbatim %}
                <li ng-repeat="group in groups" ng-if="group.resource_counts.geoapp.total > 0">
                    <a data-value="{{ group.name }}" data-filter="group__group_profile__slug__in" ng-click="multiple_choice_listener($event)" class="{{group.active}}">{{ group.group_profile.title }}
                        <span class="badge pull-right">{{ group.resource_counts.geoapp.total }}</span>
                    </a>
                </li>
                {% endverbatim %}
            {% endif %}
        </ul>
    </nav>
{% endif %}
{% if SEARCH_FILTERS.GROUP_CATEGORIES_ENABLED %}
    <nav class="filter" ng-cloak>
        <h4><a href="#" class="toggle toggle-nav"><i class="fa fa-chevron-right"></i> {% trans "Group Categories" %}</a></h4>
        <ul class="nav closed" id="group-categories">
            {% if facet_type == 'layers' %}
                {% verbatim %}
                <li ng-repeat="groupCategory in groupCategories" ng-if="groupCategory.resource_counts.layer.total > 0">
                    <a data-value="{{ groupCategory.slug }}" data-filter="group__group_profile__categories__slug__in" ng-click="multiple_choice_listener($event)" class="{{groupCategory.active}}">{{ groupCategory.name }}
                        <span class="badge pull-right">{{ groupCategory.resource_counts.layer.total }}</span>
                    </a>
                </li>
                {% endverbatim %}
            {% elif facet_type == 'documents' %}
                {% verbatim %}
                <li ng-repeat="groupCategory in groupCategories" ng-if="groupCategory.resource_counts.document.total > 0">
                    <a data-value="{{ groupCategory.slug }}" data-filter="group__group_profile__categories__slug__in" ng-click="multiple_choice_listener($event)" class="{{groupCategory.active}}">{{ groupCategory.name }}
                        <span class="badge pull-right">{{ groupCategory.resource_counts.document.total }}</span>
                    </a>
                </li>
                {% endverbatim %}
            {% elif facet_type == 'maps' %}
                {% verbatim %}
                <li ng-repeat="groupCategory in groupCategories" ng-if="groupCategory.resource_counts.map.total > 0">
                    <a data-value="{{ groupCategory.slug }}" data-filter="group__group_profile__categories__slug__in" ng-click="multiple_choice_listener($event)" class="{{groupCategory.active}}">{{ groupCategory.name }}
                        <span class="badge pull-right">{{ groupCategory.resource_counts.map.total }}</span>
                    </a>
                </li>
                {% endverbatim %}
            {% elif facet_type == 'geoapps' %}
                {% verbatim %}
                <li ng-repeat="groupCategory in groupCategories" ng-if="groupCategory.resource_counts.geoapp.total > 0">
                    <a data-value="{{ groupCategory.slug }}" data-filter="group__group_profile__categories__slug__in" ng-click="multiple_choice_listener($event)" class="{{groupCategory.active}}">{{ groupCategory.name }}
                        <span class="badge pull-right">{{ groupCategory.resource_counts.geoapp.total }}</span>
                    </a>
                </li>
                {% endverbatim %}
            {% endif %}
        </ul>
    </nav>
{% endif %}
{% if SEARCH_FILTERS.DATE_ENABLED %}
<nav class="filter" ng-cloak>
  <h4><a href="#" class="toggle toggle-nav"><i class="fa fa-chevron-right"></i>{% trans "Date" %}</a></h4>
  <ul class="nav closed" id="date_start">
    <label>{% trans "Date begins after:" %}</label>
    <li><input value="yyyy-mm-dd" data-date-format="YYYY-MM-DD" type="text" class="datepicker" placeholder="{% trans 'yyyy-mm-dd' %}" ng-model="date_query.date__gte" /></li>
  </ul>
  <ul class="nav closed" id="date_end">
    <label>{% trans "Date ends before:" %}</label>
    <li><input value="yyyy-mm-dd" data-date-format="YYYY-MM-DD" type="text" class="datepicker" placeholder="{% trans 'yyyy-mm-dd' %}" ng-model="date_query.date__lte" /></li>
  </ul>
</nav>
{% endif %}
